package com.sweet.imserver.model;

import io.vertx.core.json.JsonObject;

import java.util.Objects;
import java.util.UUID;

public class Friend {
  private String fid; // 好友ID

  private String nickName; // 昵称

  private String note; // 备注

  private String city; // 城市

  private String avatar;// 头像

  public Friend() {
  }

  public Friend(User user, String note) {
    this.fid = user.getId();
    this.nickName = user.getNickName();
    this.note = note;
    this.city = user.getCity();
    this.avatar = user.getAvatar();
  }

  public String toJson() {
    return  new JsonObject()
      .put("fid", fid)
      .put("nickName", nickName)
      .put("note", note)
      .put("city", city)
      .put("avatar", avatar).encode();
  }

  public String getFid() {
    return fid;
  }

  public void setFid(String fid) {
    this.fid = fid;
  }

  public String getNickName() {
    return nickName;
  }

  public void setNickName(String nickName) {
    this.nickName = nickName;
  }

  public String getNote() {
    return note;
  }

  public void setNote(String note) {
    this.note = note;
  }

  public String getCity() {
    return city;
  }

  public void setCity(String city) {
    this.city = city;
  }

  public String getAvatar() {
    return avatar;
  }

  public void setAvatar(String avatar) {
    this.avatar = avatar;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    Friend friend = (Friend) o;
    return Objects.equals(fid, friend.fid);
  }

  @Override
  public int hashCode() {
    return Objects.hash(fid);
  }

  @Override
  public String toString() {
    return "Friend{" +
      "fid='" + fid + '\'' +
      ", nickName='" + nickName + '\'' +
      ", note='" + note + '\'' +
      ", city='" + city + '\'' +
      ", avatar='" + avatar + '\'' +
      '}';
  }
}
